<template>
  <van-popup v-model:show="curComp.config.isActive" round position="bottom">
    <van-date-picker
      v-model="vModelValue"
      :columns-type="['year', 'month', 'day']"
      @confirm="curComp.config.isActive = false"
      @cancel="curComp.config.isActive = false"
    />
  </van-popup>
</template>
<script setup lang='ts'>
import { useAttrs, useTempValue } from 'generator/hooks'
import { ref, watch } from 'vue';

const props = defineProps<{
  panelJson: TPanel
  curComp: TComp
}>()

const vModelValue = ref([])

const attrs = useAttrs(props.curComp.attrs)

const value = useTempValue(attrs, props.curComp, props.panelJson)

watch(() => value, () => {
  vModelValue.value = value.value
}, { deep: true, immediate: true })
</script>
<style scoped>
.wft-w-h-100 {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
}
</style>